package com.petshop.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.common.constant.BalzLogger;
import com.petshop.model.Product;
import com.petshop.service.ProductService;
import com.petshop.service.ProductServiceImpl;

public class ProductAction{
	
	private static final long serialVersionUID = 1L;
	
	BalzLogger logger = new BalzLogger();
	
	
	public void newProductLoad(HttpServletRequest request, HttpServletResponse response){
		
		logger.debug("Product productNewLoad is Load !!!");

		ProductService productService = new ProductServiceImpl();
		List<Product> productNewLoad = productService.getNewProductList();
		
		response.setCharacterEncoding("UTF-8");
		request.setAttribute("productNewLoad", productNewLoad); // Set product to request
		
	}
	
	public void rateProductLoad(HttpServletRequest request, HttpServletResponse response){
		
		logger.debug("Product productRateList is Load !!!");
		
		ProductService productService = new ProductServiceImpl();
		List<Product> productRateList= productService.getRateProductList();
		
		response.setCharacterEncoding("UTF-8");
		request.setAttribute("productRateList", productRateList); // Set product to request
		
	}
	
	public void allProductLoad(HttpServletRequest request, HttpServletResponse response){
		
		logger.debug("Product allProductList is Load !!!");
		
		ProductService productService = new ProductServiceImpl();
		List<Product> allProductList = productService.getAllProductList();
		
		response.setCharacterEncoding("UTF-8");
		request.setAttribute("allProductList", allProductList); // Set product to request
		
	}
	
}
